#include <stdio.h>
#include <stdlib.h>

#define SIZE 4096

int main ( int argc, char const *argv[] ) {
    char ch = 0;
    int cnt = 0, i = 0, j = 0;
    FILE *fp;
/*open*/
    fp = fopen("/tmp/f1.txt","w+");
    if ( !fp ) {
        printf("Err create\n");
        return EXIT_FAILURE;
    }
/*input1*/
    printf("Please input:\n");
    scanf("%c",&ch);
/*input2*/
    do {
        fputc(ch, fp);
        scanf("%c",&ch);
        cnt++;
    } while ( ch != '#' );
    printf("Success input!\n");
    rewind(fp);
/*output1*/
    char word[SIZE] = {0};
    while ( ( ch = getc(fp) ) != EOF ) {
        word[i] = ch;
        i++;
/*check*/
        if ( i == SIZE ) {
            printf("FULL\n");
            break;
        }
    }
/*output2*/
    printf("Input Done!\n");
    for ( j = 0; j <= i; j++ ) {
        printf("%c",word[j]);
    }
    printf("\nOutput Done!\n");
/*close*/
    fclose(fp);
    return EXIT_SUCCESS;
}